package com.example.verifysdk.scancode;

import android.content.Context;

import com.example.verifysdk.LogUtil;
import com.example.verifysdk.UploadHelper;

import okhttp3.Callback;
import okhttp3.OkHttpClient;
import okhttp3.Request;

/**
 *
 * @author LiuV
 * @date 2017/6/14
 */

public class ShowQRInfoModel {

    private static final String TAG = "ShowQRInfoModel";

    public void loginScanUser(Context context, String pid, String uid, Callback callback) {
        LogUtil.i(TAG, "---loginScanUser===api/reg/mechanicLogin");

        Request request = new Request
                .Builder()
                .url(UploadHelper.getUrl(context) + "api/reg/mechanicLogin/" + pid + "/" + uid)
                .get()
                .build();
        new OkHttpClient().newCall(request).enqueue(callback);
    }

    public void checkSecret(Context context, String token, String secret, Callback callback) {
        LogUtil.i(TAG, "---checkSecret===api/checkTOTP");

        Request request = new Request
                .Builder()
                .addHeader("APP_TOKEN", token)
                .url(UploadHelper.getUrl(context) + "api/checkTOTP/" + secret)
                .get()
                .build();

        new OkHttpClient().newCall(request).enqueue(callback);
    }
}
